package cn.myblog.ainblog.conroller;

import cn.myblog.ainblog.model.CategoryModel;
import cn.myblog.ainblog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

/**
 * @author Dovaior
 * @Description 前端页面分类的控制器
 * @create 2021-05-04 10:12
 **/
@Controller
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/CategoryPage")
    public String category(Model model){
        List<CategoryModel> categoryModelList = categoryService.selectAll();
        model.addAttribute("categoryModelList",categoryModelList);
        return "category";
    }
}
